package com.tancire.member.controller;

import com.tancire.common.annotation.Client;
import com.tancire.common.core.controller.BaseController;
import com.tancire.common.core.domain.AjaxResult;
import com.tancire.common.enums.UserSource;
import com.tancire.member.domain.MemberTask;
import com.tancire.member.service.IMemberTaskService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 手机端通用会员接口
 *
 * @author chenchao
 * @version 1.0
 * @since 2024/10/29 17:20
 */
@RestController
@RequestMapping("/member/client/member")
public class MemberClientMemberController extends BaseController {

    @Resource
    private IMemberTaskService memberTaskService;

    /**
     * 领取复活卡
     */
    @Client(UserSource.MEMBER)
    @PostMapping("/add/live/card")
    public AjaxResult addLiveCard() {
        this.memberTaskService.addLiveCard();
        return AjaxResult.success();
    }

    /**
     * 领取复活卡
     */
    @Client(UserSource.MEMBER)
    @GetMapping("/use/live/card")
    public AjaxResult useLiveCard() {
        this.memberTaskService.useLiveCard();
        return AjaxResult.success();
    }

    /**
     * 领取复活卡
     */
    @Client(UserSource.MEMBER)
    @GetMapping("/task/info")
    public AjaxResult getTaskInfo() {
        MemberTask taskInfo = this.memberTaskService.getTaskInfo();
        return AjaxResult.success(taskInfo);
    }

}
